package DesignPatern.A02_工厂模式.QXB.A01_基本模式;

/**
 * @Author: Du
 * @Date: 2021/7/20 12:24
 */
public class HumanFactory extends AbstractHumanFactory
{
    @Override
    public <T extends Human> T crateHuman(Class<T> human)
    {
        Human human1 = null;
        try
        {
            human1 = (T) Class.forName(human.getName()).newInstance();
        } catch (InstantiationException e)
        {
            e.printStackTrace();
        } catch (IllegalAccessException e)
        {
            e.printStackTrace();
        } catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
        return (T) human1;
    }
}
